{extend name="layout_modal" /}
{block name="css"}
<link rel="stylesheet" href="{$statics}plugins/select2/select2.css">
<link href="{$statics}plugins/um/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
{/block}
{block name="content"}
<!-- Content Header (Page header) -->
<section class="content" style="padding-top:0px;">
<div class="row">
  <div class="box">
    <!-- /.box-header -->
    <!-- form start -->
    <form role="form" action="{:url('data_update')}">
      <div class="box-body">
        <div class="form-group">
          <label for="exampleInputEmail1">配置标示</label>
          <input type="text" class="form-control" placeholder="配置标示" name="name" value="{$info.name}">
        </div>
        <div class="form-group">
          <label for="exampleInputEmail1">配置标题</label>
          <input type="text" class="form-control" placeholder="配置标题" name="title" value="{$info.title}">
        </div>
        <div class="form-group">
          <label for="exampleInputEmail1">排序</label>
          <input type="text" class="form-control" placeholder="排序" name="sort" value="{$info.sort}">
        </div>
        <div class="form-group">
          <label for="exampleInputEmail1">配置类型</label>
          <select name="type" class="form-control" onchange="check_type(this.value)">
            {foreach Think.config.CONFIG_TYPE_LIST as $k => $v}
            <option value="{$k}" {eq name="$k" value="$info['type']"}selected{/eq}>{$v}</option>
            {/foreach}
          </select>
        </div>
        <div class="form-group">
          <label for="exampleInputEmail1">配置分组</label>
          <select name="group" class="form-control">
            {foreach Think.config.CONFIG_GROUP_LIST as $k => $v}
            <option value="{$k}" {eq name="$info.group" value="$k"}selected{/eq}>{$v}</option>
            {/foreach}
          </select>
        </div>
        <div class="form-group">
          <label for="exampleInputEmail1" id="value">配置值</label>
          {eq name="info.type" value="5"}
          <textarea id="myEditor1" name="value" class="form-control" style="width:100%;height:240px;">{$info.value}</textarea>
          {else /}
          <textarea name="value" class="form-control" style="width:100%;height:240px;">{$info.value}</textarea>
          {/eq}
        </div>
        <div class="form-group">
          <label for="exampleInputEmail1">配置项（如果是枚举型 需要配置该项）</label>
          <textarea name="extra" class="form-control" style="width:100%;height:240px;">{$info.extra}</textarea>
        </div>
        <div class="form-group">
          <label for="exampleInputEmail1">说明（配置详细说明）</label>
          <textarea name="remark" class="form-control" style="width:100%;height:240px;">{$info.remark}</textarea>
        </div>
      </div>
      <!-- /.box-body -->
      <input type="hidden" name="id" value="{$info.id}">
    </form>
  </div>
</div>
<textarea id="myEditor" name="value" class="form-control" style="width:100%;height:240px;">{$info.value}</textarea>
</section>
<!-- /.content -->
{/block}
{block name="script"}
<script src="{$statics}plugins/select2/select2.full.min.js"></script>
<script type="text/javascript" src="{$statics}plugins/um/third-party/template.min.js"></script>
<script type="text/javascript" charset="utf-8" src="{$statics}plugins/um/umeditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="{$statics}plugins/um/umeditor.min.js"></script>
<script type="text/javascript" src="{$statics}plugins/um/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
    var um = UM.getEditor('myEditor',{initialFrameWidth:null});
    var um = UM.getEditor('myEditor1',{initialFrameWidth:null});
</script>
<script type="text/javascript">
  $(document).ready(function() {
    $("#myEditor").parent().parent().hide();
  });
  function check_type (value) {
    $("#value").next().remove();
    if (value == 5) {
      $("#value").after($("#myEditor").parent().parent().clone().show());
    }else{
      $("#value").after("<textarea name='value' class='form-control' style='width:100%;height:240px;'>{$info.value}</textarea>");
    }
  }
</script>
{/block}